﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.Search.TxSearchCommand.CUiSearchCommandWindow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.Search.TxSearchCommand;

public class CUiSearchCommandWindow : TxWindow, IComponentConnector
{
  internal Canvas cCloseCanvas;
  public DnProcessSimulateCommands.Search.TxMainSearchControl.TxMainSearchControl sSearch;
  private bool _contentLoaded;

  public CUiSearchCommandWindow()
  {
    this.InitializeComponent();
    this.sSearch.DefineParentWindow((TxWindow) this);
  }

  private void Window_Loaded(object sender, RoutedEventArgs e) => this.sSearch.Focus();

  private void sSearch_OnEsc(object source, EventArgs e) => ((Window) this).Close();

  private void sSearch_OnPostSelectionChanged(object source, EventArgs e)
  {
    ((Window) this).Close();
  }

  private void cCloseCanvas_MouseUp(object sender, MouseButtonEventArgs e)
  {
    ((Window) this).Close();
  }

  private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
  {
    if (e.ChangedButton != MouseButton.Left)
      return;
    ((Window) this).DragMove();
  }

  private void TxWindow_LocationChanged(object sender, EventArgs e)
  {
    this.sSearch.txsSearch.ParentWindowFocusLost();
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/search/txsearchcommand/cuisearchcommandwindow.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  internal Delegate _CreateDelegate(Type delegateType, string handler)
  {
    return Delegate.CreateDelegate(delegateType, (object) this, handler);
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        ((FrameworkElement) target).Loaded += new RoutedEventHandler(this.Window_Loaded);
        ((Window) target).LocationChanged += new EventHandler(this.TxWindow_LocationChanged);
        break;
      case 2:
        ((UIElement) target).MouseDown += new MouseButtonEventHandler(this.TextBlock_MouseDown);
        break;
      case 3:
        this.cCloseCanvas = (Canvas) target;
        this.cCloseCanvas.MouseUp += new MouseButtonEventHandler(this.cCloseCanvas_MouseUp);
        break;
      case 4:
        this.sSearch = (DnProcessSimulateCommands.Search.TxMainSearchControl.TxMainSearchControl) target;
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
